<template>
    <section>
        <van-nav-bar
                :title = title
                :left-text=left_text
                :right-text= right_text(right_show)
                @click-left="onClickLeft"
                @click-right="onClickRight"
                :fixed = true
        />
        <div style="height: 1.2rem;"></div>
        <kefu :show="kefu_show" :s_show="s_show" @fun_kefu_x="fun_kefu_x"></kefu>
    </section>

</template>

<script>
    import kefu from '@/components/kefu';
    export default {
        name: "navbar",
        props: ['title','right_show','type','left_text'],
        data() {
            return {
                kefu_show: false,
                s_show: false
            }
        },
        methods: {
            onClickLeft() {
                if(this.type == 1){
                    this.$router.back(0)
                }
                else if(this.type == 2){
                    this.$router.push('/index')
                }

            },
            onClickRight() {
                if(this.right_show){
					this.$router.push('/serviceCenter')
                    // this.s_show = true
                    // this.kefu_show = true
                }
            },
            right_text(type) {
                return type? this.$t('h_title.xianshangkefu'): ''
            },
            fun_kefu_x() {
                this.s_show = false
                this.kefu_show = false
            }
        },
        components: {
            kefu
        }

    }
</script>

<style>
    .van-nav-bar{
        background-color: #08090b;
        color: #fff;
    }
    .van-icon-arrow-left:before,.van-nav-bar__text,.van-nav-bar__title{
        color: #fff;
    }
</style>
